let express = require('express')
// let path = require('path');
// let favicon = require('serve-favicon');
let logger = require('morgan')
let cookieParser = require('cookie-parser')
let bodyParser = require('body-parser')
// 导入路由设置
// let index = require('./routes/index');
//let users = require('./routes/users');
let queue = require('./modules/proxy/queue')
let all = require('./modules/proxy/all')
let upload = require('./modules/proxy/upload')

let app = express()

// view engine setup
// app.set('views', path.join(__dirname, 'views'));
// app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json({limit:'10mb'}));//设置post body数据的大小
app.use(cookieParser())
// 路由
app.use('/proxy/queue*', queue)
app.use('/proxy/all*', all)
app.use('/upload*', upload)

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  res.json({status:'-5', res: '', code: '404', msg: '没有相应接口'})
  res.end();
})


module.exports = app
